/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.logicwin.RobotTravel.utils;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;

import com.logicwin.RobotTravel.R;
import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author chapeng
 */
public class ConfigUtils {
	private static Map<String, Integer[]> picMap = new HashMap<String, Integer[]>();
	private static Map<String, Integer[]> picPreviewMap = new HashMap<String, Integer[]>();
	private static Map<String, Integer[]> picsMap = new HashMap<String, Integer[]>();
	
	static {
		Integer[] sceen1_pics = new Integer[] { new Integer(R.drawable.dahuitang1),
				new Integer(R.drawable.dahuitang2),
				new Integer(R.drawable.dahuitang3),
				new Integer(R.drawable.dahuitang4),
				};
		
		Integer[] sceen2_pics = new Integer[] { new Integer(R.drawable.badi1f),
				new Integer(R.drawable.badi2),
				new Integer(R.drawable.badi3f),
				new Integer(R.drawable.badi4),
				new Integer(R.drawable.badi5),
				new Integer(R.drawable.badi6) };
		
		Integer[] sceen3_pics = new Integer[] { new Integer(R.drawable.hfj1),
				new Integer(R.drawable.hfj2),
				new Integer(R.drawable.hfj3),
				new Integer(R.drawable.hfj4),
				new Integer(R.drawable.hfj5)};

		picsMap.put("sceen1", sceen1_pics);
		picsMap.put("sceen2", sceen2_pics);
		picsMap.put("sceen3", sceen3_pics);
	}
	
	static {
		Integer[] sceen1 = new Integer[] { new Integer(R.drawable.dhtf1),
				new Integer(R.drawable.dhtf2),
				new Integer(R.drawable.novedio3) };
		Integer[] sceen2 = new Integer[] { new Integer(R.drawable.baidif1),
				new Integer(R.drawable.baidif2),
				new Integer(R.drawable.videopic) };
		Integer[] sceen3 = new Integer[] { new Integer(R.drawable.hfjf1),
				new Integer(R.drawable.hfjf2),
				new Integer(R.drawable.novedio3) };

		picMap.put("sceen1", sceen1);
		picMap.put("sceen2", sceen2);
		picMap.put("sceen3", sceen3);
	}
	
	static {
		Integer[] sceen1_prev_pics = new Integer[] { new Integer(R.drawable.dht1pre),
				new Integer(R.drawable.dht2pre),
				new Integer(R.drawable.dht3pre),
				new Integer(R.drawable.dht4pre),
				};
		
		Integer[] sceen2_prev_pics = new Integer[] { new Integer(R.drawable.baidi1pre),
				new Integer(R.drawable.baidi2pre),
				new Integer(R.drawable.baidi3pre),
				new Integer(R.drawable.baidi4pre),
				new Integer(R.drawable.baidi5pre),
				new Integer(R.drawable.baidi6pre) };

		Integer[] sceen3_prev_pics = new Integer[] { new Integer(R.drawable.hfj1pre),
				new Integer(R.drawable.hfj2pre),
				new Integer(R.drawable.hfj3pre),
				new Integer(R.drawable.hfj4pre),
				new Integer(R.drawable.hfj5pre)
				};

		picPreviewMap.put("sceen1", sceen1_prev_pics);
		picPreviewMap.put("sceen2", sceen2_prev_pics);
		picPreviewMap.put("sceen3", sceen3_prev_pics);
	}

	private static final String[] news = { "多国军事介入利比亚致200人伤亡 卡扎菲吁反击",
			"日警方称宫城县地震、海啸遇难人数或超1.5万人", "西湖迎来旅游旺季 景区道路启动单双号限行" };
	private static int currentNewsPosition;

	public static String getNextNews() {
		String rtn = news[currentNewsPosition];
		currentNewsPosition = (++currentNewsPosition) % news.length;
		return rtn;
	}

	public static Integer[] getPreviewDrawable(String sceen) {
		return picPreviewMap.get(sceen);
	}
	
	public static int getPicsDrawable(String sceen, int tab) {
		Integer[] pics = picsMap.get(sceen);
		return pics[tab].intValue();
	}
	
	public static int getDrawable(String sceen, int tab) {
		Integer[] pics = picMap.get(sceen);
		return pics[tab].intValue();
	}

	public static boolean hasVideo(String sceen) {
		if (sceen.equals("sceen2"))
			return true;
		else
			return false;
	}

	// how to judge the type of device?
	public static int getNewsTextSize(Context activity) {
		if (SystemParams.getWindowWidth((Activity) activity) >= 600) {
			return 30;
		} else
			return 16;
	}

	public static int getNewsTextColor() {
		return Color.RED;
	}

	// needs to debug
	public static int getTextMoveSpeed(Context activity) {
		if (SystemParams.getWindowWidth((Activity) activity) >= 600) {
			return 10;
		} else
			return 5;
	}

}
